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