UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CPyWQUPnxSNi5h5LAA4RxYyd36+H/chgSZ80eS84gk0='
WHERE
key_id = '7e7595ea13cf3b649a1cefd4c9f5efd24983dc0629b85af88f664225044a2f68'
AND (
token = 'CPyWQUPnxSNi5h5LAA4RxYyd36+H/chgSZ80eS84gk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)