UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3mcHTRgo+m7O0f8fEmOyfpnVhz98hhvRRB/xLWIGkhg='
WHERE
key_id = '50171211589080fa3512600e88cbcb096779a1689e2167b31fc15d5e5634f64d'
AND (
token = '3mcHTRgo+m7O0f8fEmOyfpnVhz98hhvRRB/xLWIGkhg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)