UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9YSeoMS28IpR7uBy+FTjy8AmMFMw7WlIk8vAvcIgjSU=' 
WHERE 
  key_id = 'ebb5c0e93f364c9a6bd69d03706c1696031d97e19f8b17e9767f20fba5459f0d' 
  AND (
    token = '9YSeoMS28IpR7uBy+FTjy8AmMFMw7WlIk8vAvcIgjSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020