UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KOnHNuKlAIR91mxXO84TjncyYhWhlcq2+7nX8+ASGCA='
WHERE
key_id = 'b4d3fcb6ecc555082e39f8a46823c76f17ee20790c912495620f60cab496a705'
AND (
token = 'KOnHNuKlAIR91mxXO84TjncyYhWhlcq2+7nX8+ASGCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)