UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYBKwPw7eoVRxQtw5uYGHdb+jZPel/nJQAtm2TgrsoQ=' 
WHERE 
  key_id = 'd7d7d531a87df142e99f9aa5dc7a6439245a7be50db0a819d4f52b40ecb671d2' 
  AND (
    token = 'DYBKwPw7eoVRxQtw5uYGHdb+jZPel/nJQAtm2TgrsoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034