UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pAssaWGh00Ekh3e8ayV+9Jqe8CxfUqlShq127o+5B0s=' 
WHERE 
  key_id = '7395e1f75cd9edf40063f928a628c53844b0742798ba5981b67fc316b218dd7e' 
  AND (
    token = 'pAssaWGh00Ekh3e8ayV+9Jqe8CxfUqlShq127o+5B0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040