UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AFiMpXn2lwdaAK0+epn5dchKcUIOhDqV4JnFkX6+kuo='
WHERE
key_id = '75b77aa12431a3d935489e91d0cfb92a3c68b68ea875c9db05e0ad1457fde58a'
AND (
token = 'AFiMpXn2lwdaAK0+epn5dchKcUIOhDqV4JnFkX6+kuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)