UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Zat97dO4SsLbh5FqYKmWwhgT8dPOqSqGd9kybnzbaw='
WHERE
key_id = 'a39f04053a1e89cc6bf110b42edb407f4e4a4d0ce3c95414708d7e0d1ecd5475'
AND (
token = '4Zat97dO4SsLbh5FqYKmWwhgT8dPOqSqGd9kybnzbaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)