UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'be2oK0k/QdeuoGfQNR567WYTYA9/bmuVknPkJ1VcleY='
WHERE
key_id = '4d945a67ee84923dda61aa86db18b3f743230e6e76d48e4b01af5705db4d682e'
AND (
token = 'be2oK0k/QdeuoGfQNR567WYTYA9/bmuVknPkJ1VcleY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)