UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9f5BEj5KELWB3xaXPlq5su1mpngENcUMnMGbNrauE6E=' 
WHERE 
  key_id = '07b07e289e43e80654bfc41cb99c5962d8e9351e748d3e186bae517d4ff5c180' 
  AND (
    token = '9f5BEj5KELWB3xaXPlq5su1mpngENcUMnMGbNrauE6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031