UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XN2CLDjZqxN13HZSNRD8nScCpf6E6A9LFNzn1imOfeQ=' 
WHERE 
  key_id = '7114dad040e2961dd4ec07aa7c3384b273e6197e57cce23919fba3b118335365' 
  AND (
    token = 'XN2CLDjZqxN13HZSNRD8nScCpf6E6A9LFNzn1imOfeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024