UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u4adW3+fG6X6FUb/7tGiKlosQ36XaxQnSg1aSSoyhgI='
WHERE
key_id = 'b382092ad14ebc877765699a4c0cba44fb8980904821ed9935d1c88c2c1de530'
AND (
token = 'u4adW3+fG6X6FUb/7tGiKlosQ36XaxQnSg1aSSoyhgI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)