UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5g5dqqM/l0Ox7eqFfGmn5XW3Lme5fBfycw9VteD2mu4='
WHERE
key_id = 'bffdb7f43c391fc3b783cc1de2274a72e389bece6390d136eb78558d767da4bc'
AND (
token = '5g5dqqM/l0Ox7eqFfGmn5XW3Lme5fBfycw9VteD2mu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)