UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KxPav5b788rMD5c8za1NY76VX6VxuELH9pU04mVT4Bs=' 
WHERE 
  key_id = '32edd43305ef0ee563ef82d99d7a901b946d540699328992e24f3a60d6c01031' 
  AND (
    token = 'KxPav5b788rMD5c8za1NY76VX6VxuELH9pU04mVT4Bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063