UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BZegkzp5KDpQ0jl0wb41R3tHkrmhxasoqY3r++oE+H4='
WHERE
key_id = '4ac2dfea99b75b4ab1c0760672ad4dfc7e62b40e6f4577df7e3bf1fa0f61b592'
AND (
token = 'BZegkzp5KDpQ0jl0wb41R3tHkrmhxasoqY3r++oE+H4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)