UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cXKM4f6O5HUhkmTXwd3VhqAc110TKHX6oMqbgLBfNG8='
WHERE
key_id = 'a8bcccfc7e4bcbfd5627b644d0c61dd843bb77121b2dcb4eac9ff3f902b0b355'
AND (
token = 'cXKM4f6O5HUhkmTXwd3VhqAc110TKHX6oMqbgLBfNG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)