UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1mm30D68CJZtc09X2LwsTkd87+y3SFdtoExTK2IQRg=' 
WHERE 
  key_id = 'f746cfa26b898ffc1be291927f5e3c1e829e3fe677eccdd0444130a7b4fb01e6' 
  AND (
    token = 'k1mm30D68CJZtc09X2LwsTkd87+y3SFdtoExTK2IQRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028