UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ds91t8QNnx0D4NHy+PuOpCthYcKjK5ByI5TJHwvo2eg=' 
WHERE 
  key_id = '363f5889d850d75b158400241e656e62d56102bc340923d49c62d24a05a16184' 
  AND (
    token = 'ds91t8QNnx0D4NHy+PuOpCthYcKjK5ByI5TJHwvo2eg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020