UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wmaoko2qd79lH3np5tpBfTmt2Cua1ERtRB8QPaPyOas=' 
WHERE 
  key_id = 'a25b4a99046013e4f6096c2690062c81f58bc6b2712068a7567ef2f1d9ed8449' 
  AND (
    token = 'Wmaoko2qd79lH3np5tpBfTmt2Cua1ERtRB8QPaPyOas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039