UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p3VIpfpcN70zyx4rKSE8qycOJQZIo6AX+1sWcAnj6rA='
WHERE
key_id = '7831fd65c27fcb836ffb3733d62dbcf05920989c4903d89020b08521428d1ecb'
AND (
token = 'p3VIpfpcN70zyx4rKSE8qycOJQZIo6AX+1sWcAnj6rA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)