UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9nGrCVkr8DF4NUNdg3chQUhfeuK8J7RgVDjZBe+drQ=' 
WHERE 
  key_id = '797c3ec00f88c400b5762f4b7896ae611420a150c571dc0321b088e748a3ebb0' 
  AND (
    token = 'W9nGrCVkr8DF4NUNdg3chQUhfeuK8J7RgVDjZBe+drQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029