UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SF6jJCJznAEZir7KlfVbkxCMNC4sVMLW8UF3I+wgtzI=' 
WHERE 
  key_id = 'c1ccaa84724be290aa5ad70343daa7936f7f8ed787ffe794ba604d7779c90be1' 
  AND (
    token = 'SF6jJCJznAEZir7KlfVbkxCMNC4sVMLW8UF3I+wgtzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044