UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KGRC2xIvz1nmgJUab2L5uTWC3H7sifBBLiNYOG9dXBM='
WHERE
key_id = '06a36ab213995ab27d7d550dc3c1f85c09a85114f9988c45807d437351949f46'
AND (
token = 'KGRC2xIvz1nmgJUab2L5uTWC3H7sifBBLiNYOG9dXBM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)