UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c7bhGN0XGULLqGDcABAmgndZ1/EJqLXUdIlQnYrNEYw='
WHERE
key_id = 'cf9821959934ffe8920a9de938871f4e0cd07faddf8a23954ea7f14ba19e9905'
AND (
token = 'c7bhGN0XGULLqGDcABAmgndZ1/EJqLXUdIlQnYrNEYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)