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