UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HQYbIyt6wD4ylxbb/X62106tbjsg8TOeYEyJ7WtPCgM='
WHERE
key_id = 'fb7bfe8bee5faa0055b807593ae784cc40307c0026d04e40209a0b872c4dc146'
AND (
token = 'HQYbIyt6wD4ylxbb/X62106tbjsg8TOeYEyJ7WtPCgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)