UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TYU+SGNbd3qBWAugy2RMTk2NlO8GnVjFYH8rPaFpCxU=' 
WHERE 
  key_id = '542a8e25f2d0d671303ef4936e7e4fe760abb6e627909c2d042c2f28479aa798' 
  AND (
    token = 'TYU+SGNbd3qBWAugy2RMTk2NlO8GnVjFYH8rPaFpCxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037