UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ryi8FPDxU4ipnKfv4c6A6v2DgY+xs0sl2K2Tp9D639c='
WHERE
key_id = 'fa82671a2ba4df4af27eb42909b5c3268dd24542ecae4abadee43b5394002e46'
AND (
token = 'ryi8FPDxU4ipnKfv4c6A6v2DgY+xs0sl2K2Tp9D639c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)