UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZYiRNv9FDHyQgfC2oKYW4c9bqy55hB9gszd36sLtLBQ='
WHERE
key_id = 'c9e4f559c9d9d02803eafcc1898c6ec4398acce313d19abe0a004c197dd11106'
AND (
token = 'ZYiRNv9FDHyQgfC2oKYW4c9bqy55hB9gszd36sLtLBQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)