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