UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JJcKgKXalYvLW4KjCCu7/Qrmr+iLiiBbpD4co6EcN+8=' 
WHERE 
  key_id = 'e1fe55e14735cda4a35c4bebd6e2e2d263d6efdcea532b074b53e64417dadc39' 
  AND (
    token = 'JJcKgKXalYvLW4KjCCu7/Qrmr+iLiiBbpD4co6EcN+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025