UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BZtbtK/QoHpmJOcJ300TMU9BJsqBy9rSW2M9dUMceEY='
WHERE
key_id = 'd3abec9f303cf0e0423ba9bc6768dea619b708f6bbc44044c4b11f0417c9161d'
AND (
token = 'BZtbtK/QoHpmJOcJ300TMU9BJsqBy9rSW2M9dUMceEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)