UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'efAFYgza/JFMalBSCBl6i/2jI5zRUy2b2I1O7zw9YX8=' 
WHERE 
  key_id = '1cd078c3c82e5d54506b7e8c58075d4bd38045dad33680767064aa3fff334834' 
  AND (
    token = 'efAFYgza/JFMalBSCBl6i/2jI5zRUy2b2I1O7zw9YX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031