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