UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bd/zB1/tuCCqJG3piXOVKvH4ZIl1lwSRitdjWzRHl6Q=' 
WHERE 
  key_id = 'b25aa088a4eeec175e7817e97f8f8a1bb37490d2c8c9e319346c2e7c79739c84' 
  AND (
    token = 'Bd/zB1/tuCCqJG3piXOVKvH4ZIl1lwSRitdjWzRHl6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00095