UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b7wuBcxbEz/OYKwNd1HeJ2v2ngek1iMZtxzaxI9bOJk='
WHERE
key_id = 'ed5d3201af740fbcdc5c67102715316817eac0513e26870ace502a26f8b72702'
AND (
token = 'b7wuBcxbEz/OYKwNd1HeJ2v2ngek1iMZtxzaxI9bOJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)