UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TYPFTnQr1lVNMYXxo2eazENopmPUmEBNXyDIGQ56D1k=' 
WHERE 
  key_id = '06be292a09ad6c36920f2ea1843290bf008d69847339a4abe2d3cf2dc547e47b' 
  AND (
    token = 'TYPFTnQr1lVNMYXxo2eazENopmPUmEBNXyDIGQ56D1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052