UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ECZRqGWIkR+RiwQ7KcyyUf0vP27WKzR2KJVky7wYB0s=' 
WHERE 
  key_id = '2f0e7b49e21d33dc6ba1c30bf807a512b24f3520f67e65cb6a8415beb6ce4164' 
  AND (
    token = 'ECZRqGWIkR+RiwQ7KcyyUf0vP27WKzR2KJVky7wYB0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032