UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LnWEUqc07h1nfkkPwwcfEUP7AwmUF+z0aB0/VEFj0Vg=' 
WHERE 
  key_id = '737f217470b81b72005a2f6902019fe65e8d4810a7565479886819d23255d260' 
  AND (
    token = 'LnWEUqc07h1nfkkPwwcfEUP7AwmUF+z0aB0/VEFj0Vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030