UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TO7y4cEHp95xLUR75HOL3S9q7Kcz7XWjETlLtuADwSw=' 
WHERE 
  key_id = '75a7e558586e8eb20f48d58d149d73c13deeb0cfb23f7d7ab5aa4f02c63d4982' 
  AND (
    token = 'TO7y4cEHp95xLUR75HOL3S9q7Kcz7XWjETlLtuADwSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028