UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Dh3uTGjp2n+AIJO0iivl4Vh3owRVLwnRaU+ajaSrGY='
WHERE
key_id = 'd8474a12aeb28e2a4311042a237ae9ba4c148485a4209cd0ef2077fb957f6e4c'
AND (
token = '8Dh3uTGjp2n+AIJO0iivl4Vh3owRVLwnRaU+ajaSrGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)