UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xRQHBZkY66h8k4UgttfkGJ9J++JyBQkMLNQGGVjUNcc=' 
WHERE 
  key_id = '09b1732e8ee2ab45fcb65dbf890145d39575d6f27c0603eeebee72016b855604' 
  AND (
    token = 'xRQHBZkY66h8k4UgttfkGJ9J++JyBQkMLNQGGVjUNcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029