UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uSJpS33K+lQVkb2iSmmhXM8EoP94BNgJpccjwuWfeY4=' 
WHERE 
  key_id = '065b933a74d0af38ddd38c0c04f9c694226f3c7f5e58651df19529eab4fc0403' 
  AND (
    token = 'uSJpS33K+lQVkb2iSmmhXM8EoP94BNgJpccjwuWfeY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026