UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U1PYK6KyXAyn5xuJpPyfszpiwhVlq4vLHbUAfVqvu6U='
WHERE
key_id = 'dcff71338e82214f7de00acf88ce3955992fb4d1f4f943f97d205b838f7ea427'
AND (
token = 'U1PYK6KyXAyn5xuJpPyfszpiwhVlq4vLHbUAfVqvu6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)