UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PUYxGvsl+60Lj5/HI2Nw5pjvakW6QBqedEqhfo9LOg8='
WHERE
key_id = 'faf284c64a49f0a2dcf894f56d63d7f1de5395a5a4e6197a53489d9148749614'
AND (
token = 'PUYxGvsl+60Lj5/HI2Nw5pjvakW6QBqedEqhfo9LOg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)