UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZOZNva3puPl8sCy1I8tiZ7VX+a1rGL00tLpoGAVt9UQ='
WHERE
key_id = '20e174f286a852d7232b56d48a8d0c7b8c49161f85ae76d2857e48c8aae5f73b'
AND (
token = 'ZOZNva3puPl8sCy1I8tiZ7VX+a1rGL00tLpoGAVt9UQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)