UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ljBPzf0IksCZdLtVA6bbrU6FtGOSi+YbpFMOJSDSLk=' 
WHERE 
  key_id = '9e495bd549c61ac845203498cd0ce52f876ecab044b643fa8e1c4e16365072b7' 
  AND (
    token = '2ljBPzf0IksCZdLtVA6bbrU6FtGOSi+YbpFMOJSDSLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039