UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Th5NNGQr1X0OESX6VTXObFxFSOnb4X7x1IiaD1bq95s=' 
WHERE 
  key_id = '65470535a3f95cf57b8f1ae63b65892848c505f0868d863e32ad1bc2b31f3259' 
  AND (
    token = 'Th5NNGQr1X0OESX6VTXObFxFSOnb4X7x1IiaD1bq95s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049