UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XYbpQrI5om98J4cE8uHbj+Hh0OwV5TSzf2fd+hECiq0='
WHERE
key_id = 'd4d1bff000bd07248ed4b327f7edcb19b00b9bd04a015a66de42f00a2f7230a3'
AND (
token = 'XYbpQrI5om98J4cE8uHbj+Hh0OwV5TSzf2fd+hECiq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)