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

Query time 0.00035