UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K8xcNMsD1APAmahg4lij0Pj6ahRCsI21WLKq2wRFOPk='
WHERE
key_id = '52b45833d16749a981e889eca51cc1622b6757eaf6e23201643a7d9a7af2c581'
AND (
token = 'K8xcNMsD1APAmahg4lij0Pj6ahRCsI21WLKq2wRFOPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)